<%@ page import="org.openehr.am.archetype.constraintmodel.*" %>
<%@ page import="java.util.regex.*" %>
<%@ page import="se.acode.openehr.parser.*" %>
<%@ page import="org.openehr.am.archetype.Archetype" %>
<%@ page import="hce.ArchetypeService" %>

<%--
// in: archetypeSlot (${archetypeSlot.class}) (${archetypeSlot.rmTypeName})
--%>

<%--
<pre>
${archetypeSlot}
</pre>
--%>



<g:each in="${archetypeSlot.includes}" var="assertion">
  <div class="slot">
    <%-- FIXME: supongo que ass.exp es BinaryExpression --%>
    ${assertion.expression.leftOperand.item} <%-- FIXME: supongo que es siempre "archetype_id/value" --%>
    ${assertion.expression.operator} <%-- FIXME: NO LE ESTOY DANDO BOLA AL OPERATOR! --%>
    ${assertion.expression.rightOperand.item.pattern}<br/><%-- Tiene que ser un CString --%>
    
    <% System.out.println("ArchetypeSlot: " + assertion.expression.rightOperand.item.pattern); %>
    <g:displayArchetype rmtype="${archetypeSlot.rmTypeName}" idMatchingKey="${assertion.expression.rightOperand.item.pattern}" />
    <%--
    <g:def var="arch" value="${archetypeService.getArchetype(archetypeSlot.rmTypeName, assertion.expression.rightOperand.item.pattern)}" />
    <g:if test="${arch}">
      <div class="cobjects">
        <g:render template="templates/cComplexObject"
                  model="[cComplexObject: arch.definition, archetype:arch]" />
      </div>
    </g:if>
    --%>
    <%--
    ${assertion.tag},
    ${assertion.expression},
    ${assertion.stringExpression},
    ${assertion.variables}<br/>
    --%>
  </div>
</g:each>

